Skip to content

Add device context parameter #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 25, 2021

Conversation

vlad-nazarov
Copy link

No description provided.

@PetrovKP PetrovKP added the gpu label Mar 17, 2021
@PetrovKP
Copy link
Contributor

/azp run

@vlad-nazarov vlad-nazarov marked this pull request as ready for review March 17, 2021 16:20
@vlad-nazarov
Copy link
Author

/azp run

@PetrovKP
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@PetrovKP
Copy link
Contributor

/azp help

@azure-pipelines
Copy link

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@PetrovKP
Copy link
Contributor

/azp list

@azure-pipelines
Copy link

CI/CD Pipelines for this repository:

@PetrovKP
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@PetrovKP PetrovKP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall good, but need to check the performance of the cpu (so that your changes do not bring an overhead). come to me

bench.py Outdated
@@ -175,7 +175,11 @@ def parse_args(parser, size=None, loop_types=(),
help='Dataset name')
parser.add_argument('--no-intel-optimized', default=False, action='store_true',
help='Use no intel optimized version. '
'Now avalible for scikit-learn benchmarks'),
'Now avalible for scikit-learn benchmarks')
parser.add_argument('--device', default=None, type=str,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parser.add_argument('--device', default=None, type=str,
parser.add_argument('--device', default="host", type=str,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that None is used to run without context. Other values specify device type for a context

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, then I think the host is not needed at all

"data-format": ["pandas"],
"data-order": ["F"],
"dtype": ["float64"],
"device": ["host", "cpu", "gpu"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I run this config on a machine without a GPU driver?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly the same what happens if you try to run on a CPU wo DPC++ support - an exception. What is your suggession here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shall point somewhere that using this config file requires DPC++ support and GPU device on board

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, probably it's ok

min_samples=params.min_samples, metric='euclidean',
algorithm='auto')

# N.B. algorithm='auto' will select DAAL's brute force method when running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# N.B. algorithm='auto' will select DAAL's brute force method when running
# N.B. algorithm='auto' will select oneAPI Data Analytics Library (oneDAL) brute force method when running

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PetrovKP what about other files that @vlad-nazarov did not touch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will correct if there are such places yet

bench.py Outdated
@@ -175,7 +175,11 @@ def parse_args(parser, size=None, loop_types=(),
help='Dataset name')
parser.add_argument('--no-intel-optimized', default=False, action='store_true',
help='Use no intel optimized version. '
'Now avalible for scikit-learn benchmarks'),
'Now avalible for scikit-learn benchmarks')
parser.add_argument('--device', default=None, type=str,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that None is used to run without context. Other values specify device type for a context

bench.py Outdated
'Now avalible for scikit-learn benchmarks'),
'Now avalible for scikit-learn benchmarks')
parser.add_argument('--device', default=None, type=str,
choices=("host", "cpu", "gpu"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None shall be also included?

bench.py Outdated
@@ -197,6 +201,8 @@ def parse_args(parser, size=None, loop_types=(),
except ImportError:
print('Failed to import daal4py.sklearn.patch_sklearn.'
'Use stock version scikit-learn', file=sys.stderr)
else:
params.device = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should check if the device parameter is passed by the user and print a warning that it is useless in that case - for clarity

"data-format": ["pandas"],
"data-order": ["F"],
"dtype": ["float64"],
"device": ["host", "cpu", "gpu"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly the same what happens if you try to run on a CPU wo DPC++ support - an exception. What is your suggession here?

"data-format": ["pandas"],
"data-order": ["F"],
"dtype": ["float64"],
"device": ["host", "cpu", "gpu"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shall point somewhere that using this config file requires DPC++ support and GPU device on board

runner.py Outdated
@@ -70,6 +70,9 @@ def generate_cases(params):
parser.add_argument('--report', default=False, action='store_true',
help='Create an Excel report based on benchmarks results. '
'Need "openpyxl" library')
parser.add_argument('--device', default=None, type=str,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the parameter is duplicated in bench.py and runner.py?

min_samples=params.min_samples, metric='euclidean',
algorithm='auto')

# N.B. algorithm='auto' will select DAAL's brute force method when running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PetrovKP what about other files that @vlad-nazarov did not touch?

bench.py Outdated
'Now avalible for scikit-learn benchmarks'),
'Now avalible for scikit-learn benchmarks')
parser.add_argument('--device', default='host', type=str,
choices=('host', 'cpu', 'gpu'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you changed the behavior? For me, using None is better to depict we are not using contexts. host, cpu and gpu are values supported to create daal4py.oneapi.sycl_context - please do not introduce confusion here.

bench.py Outdated
params.device = 'host'
else:
if params.device != 'host':
print('Device context not supported without intel optimized version',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Device context is not supported for stock scikit-learn. Please use --no-intel-optimized=False with f'--device={params.device}' parameter. Fallback to --device=None.

@@ -0,0 +1,77 @@
{
"common": {
"lib": ["sklearn"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How stock or intel version of sk is specified for this config?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to launch the stock sk in this config? Maybe just add flag no-intel-optimized before config run? I think it's better to separate patched and unpatched sk launches

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - probably its better to skip device != None branches for stock sklearn

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add support to skip these cases?

Copy link
Contributor

@PetrovKP PetrovKP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge after green CI

@@ -0,0 +1,77 @@
{
"common": {
"lib": ["sklearn"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - probably its better to skip device != None branches for stock sklearn

@vlad-nazarov vlad-nazarov merged commit b847226 into IntelPython:master Mar 25, 2021
@vlad-nazarov vlad-nazarov deleted the dev/add_gpu_patch branch March 25, 2021 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants